<?php
    include('./_connect.php');

    $username = $_POST['username'];
    $password = $_POST['password'];

    $sql = "select * from user where user_name='$username' and pass_word='$password'";

    $res = $mysqli->query($sql);

    
    if($res->num_rows == 1){
        echo "<script src=\"../js/cookie.js\"></script>";
        echo "<script>cookie.set('isLogin','true',1);cookie.set('username','$username',1)</script>";
        echo "<script>location.href='../html/index1.html';</script>";
    }else{
        echo "<script>alert('登陆失败');</script>";
        echo "<script>location.href='../html/debark.html';</script>";
    }
?>